import java.util.*;


public class StockReserva {
	private List<Reserva> reservas;
	public StockReserva() {
		reservas=new ArrayList<Reserva>();
	}
	public boolean anyadirReserva(Reserva r){
		return reservas.add(r);
		
		
		
	}
	public boolean eliminarReserva(Reserva r){
		if(reservas.contains(r)){
			reservas.remove(r);
			return true;
			
			
		}else{
			System.out.println("La reserva no existe en el stock");
			return false;
		}
		
		
	}
	public boolean contiene(Reserva v){
		return reservas.contains(v);
	}
	public boolean contiene(Vehiculo v){
		for(int i=0; i<reservas.size();i++){
			if(reservas.get(i).getVehiculos().contains(v)) return true;
				
		}
		return false;
		
	}
	public void eliminaVehiculo(Vehiculo v){
		for(int i=0;i<reservas.size();i++){
			if(reservas.get(i).getVehiculos().contains(v)){
				reservas.get(i).eliminarVehiculo(v);
			}
		}
		
	}
	public int size(){
		return reservas.size();
	}
	public Reserva get(int i){
		return reservas.get(i);
	}
	public List<Reserva> getReservas(){
		
		return reservas;
	}
	public String toString(){
		String s="";
		for(int i=0;i<reservas.size();i++){
			s+=reservas.get(i)+"\n";
			
		}
		return s;
		
	}
	
	
}
